﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class admin_Category : System.Web.UI.Page
{
    CategoryBus categorybus = new CategoryBus();
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }
    protected void Save_Click(object sender, EventArgs e)
    {
        Category category = new Category();
        category.CategoryId= txtCategoryId.Text.Trim(); ;
        category.CategoryName = txtCategoryName.Text.Trim();

        if (category.CategoryId.Equals("")) 
        {
            ScriptManager.RegisterStartupScript(this, typeof(Page), "FlowerShop.com", "<script>alert('Not empty')</script>", false);
        }
        if (category.CategoryName.Equals("")) 
        {
            ScriptManager.RegisterStartupScript(this, typeof(Page), "FlowerShop.com", "<script>alert('Not empty')</script>", false);
        }
        string result = categorybus.addCategory(category);
        ScriptManager.RegisterStartupScript(this, typeof(Page), "shopflowers.com", "<script>alert('" + result + "')</script>", false);
        Response.Redirect("Category.aspx");
    }

    protected void btnEdit_Click(object sender, EventArgs e)
    {

    }
    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
   
}